<?php

declare(strict_types=1);

/**
 * @Author:     Frank
 * @contact     frank_hhm@163.com
 * @Date:       2022-11-12 11:31:45
 * @Last Modified time: 2022-12-18 18:08:09
 */
namespace app\common\dao\system;

use app\common\model\system\ConfigTabModel;
use frank\base\BaseDao;
/**
 * 配置分类
 * Class ConfigTabDao
 * @package app\common\dao\system
 */
class ConfigTabDao extends BaseDao
{
    /**
     * 设置模型
     */
    protected function setModel(): string
    {
        return ConfigTabModel::class;
    }
    
    /**
     * 获取配置分类
     */
    public function getConfigTabAll(array $searchWhere, array $field = ['*'], array $where = [])
    {
        return $this->search($searchWhere)->when(count($where), function ($query) use ($where) {
            $query->where($where);
        })->field($field)->order('sort DESC,id DESC')->select()->toArray();
    }

    /**
     * 配置分类列表
     */
    public function getConfigTabList(array $where, int $page, int $limit)
    {
        return $this->search($where)->order('sort DESC,id DESC')->page($page, $limit)->select()->toArray();
    }

    public function getConfigTabSelect(array $where){
        return $this->search($where)->order('sort DESC,id DESC')->select()->toArray();
    }
}